package com.hinnotek.amoeba.adapters.old

import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.hinnotek.amoeba.bean.old.AmibaInstallPageByUserIdBean
import com.hinnotek.amoeba.R

class TIOtherAmoebainstallListAdapter :
    BaseQuickAdapter<AmibaInstallPageByUserIdBean, BaseViewHolder>(R.layout.item_ti_other_amoeba_install_list) {
    override fun convert(holder: BaseViewHolder, item: AmibaInstallPageByUserIdBean) {
        holder.setText(R.id.tv_invoice_title, item.orgName)
        holder.setText(R.id.tv_ti_unit, item.customerName)
        holder.setText(R.id.tv_ti_project_name, item.projectName)
        holder.setText(R.id.tv_ti_pre_quote, item.preMoney)
        holder.setText(R.id.tv_ti_continued_price_increase, item.continuedTotal)
        when (item.approvalState) {
            1 -> {
                holder.setText(R.id.tv_status, "已申请")
                holder.setTextColor(R.id.tv_status, ContextCompat.getColor(context,R.color.black))
            }
            2 -> {
                holder.setText(R.id.tv_status, "安装中")
                holder.setTextColor(R.id.tv_status, ContextCompat.getColor(context,R.color.black))
            }
            3 -> {
                holder.setText(R.id.tv_status, "已拒绝")
                holder.setTextColor(
                    R.id.tv_status,
                    ContextCompat.getColor(context,R.color.xui_config_color_red)
                )
            }
            4 -> {
                holder.setText(R.id.tv_status, "安装完成")
                holder.setTextColor(
                    R.id.tv_status,
                    ContextCompat.getColor(context,R.color.xui_config_color_red)
                )
            }
        }
    }
}